package com.itheima.mapper.client;


import com.itheima.pojo.client.selectShoppingCartAllVo.SelectShoppingCartAllVo;
import com.itheima.pojo.client.addShoppingCart.AddShoppingCartDto;
import com.itheima.pojo.client.addShoppingCart.AddShoppingCartVo;
import com.itheima.pojo.client.selectShoppingCartAllVo.SelectShoppingCartByDishIdVo;
import com.itheima.pojo.client.selectShoppingCartAllVo.SelectShoppingCartBySetmealIdVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author ChenJunJie
 * @date 2022/6/13 16:19
 * 购物车的mapper层
 */
@Mapper
public interface ShoppingCartMapper {

    //添加购物车
    int addShoppingCart(AddShoppingCartDto shoppingCartDto);

    //通过购物车id查询购物车
    AddShoppingCartVo selectShoppingCartById(AddShoppingCartDto shoppingCartDto);

    //查询购物车列表通过userid
    List<SelectShoppingCartAllVo> selectShoppingCartAll(@Param("userId") String userId);

    //通过菜品id与userid查询购物车
    SelectShoppingCartByDishIdVo selectShoppingCartByDishId(@Param("dishId") String dishId ,@Param("userId") String userId);

    //通过菜品id与userid删除商品份数
    int deleteShoppingCartByDishId(SelectShoppingCartByDishIdVo dish);

    //通过套餐id与userid查询购物车
    SelectShoppingCartBySetmealIdVo selectShoppingCartBySetmealId(@Param("setmealId") String setmealId , @Param("userId") String userId);

    //通过套餐id与userid删除商品份数
    int deleteShoppingCartBySetmealId(SelectShoppingCartBySetmealIdVo setmeal);

    //通过userid删除购物车
    int deleteShoppingCartByUserId(@Param("userId") String userId);

    //通过菜品id与userid修改商品份数(减一操作)
    int updateShoppingCartByDishId(SelectShoppingCartByDishIdVo dish);

    //通过套餐id与userid修改商品份数(减一操作)
    int updateShoppingCartBySetmealId(SelectShoppingCartBySetmealIdVo setmeal);
}
